package stock;

import java.beans.Transient;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import stock.model.MapEntry;
import stock.model.Model2jin3;
import stock.model.Stocksb;
import stock.testSB.SB;
import stock.testSB.SB1;
import stock.testSB.StockDataUpdater;
import stock.testSB.StockDataUpdater2;
import stock.StockQS;

@Controller
@SuppressWarnings("all")
public class StockContrl {

	@Autowired
	private StockServiceInterface stockService;

	@Autowired
	private StockServiceInterface stock;

	@Autowired
	private StockSelect stockselect;

	@Autowired
	private StockSuanFa stockSuanFa;

	@Autowired
	private TestSHFace testSHFace;

	@Autowired
	private StockSelect1 stockSelect1;

	@Autowired
	private SunFa2Interface sunFa2;

	@Autowired
	private SunFa3Interface sunFa3;

	@Autowired
	private Sunfa4Interface sunFa4;

	@Autowired
	private StockClsServiceInterface stockClsService;

	@Autowired
	private StockQQServiceInterface stockQQService;

	@Autowired
	private StockQSInterface stockQS;

	@GetMapping("/getSBstocklist")
	@ResponseBody
	@Transactional
	public String getSBstocklist(HttpServletRequest req) {

		return convertJSONArrayToHTMLTable(StockQS.sbStockjson);
	}

	@GetMapping("/topShouban")
	@ResponseBody
	@Transactional
	public void topShouban(HttpServletRequest req) {

		stockQS.topShoubanLt();
	}

	public static boolean sbflag = false;

	@GetMapping("/getTop100")
	@ResponseBody
	@Transactional
	public String getTop100(HttpServletRequest req) {

		String gn = req.getParameter("gn");

		if (gn == null || "".equals(gn)) {
			gn = "";
		}

		JSONObject json = new JSONObject();
		json.put("gn", gn);

		JSONArray jsonarry = this.stockQS.getTop100(json);

		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < jsonarry.size(); i++) {
			String code = jsonarry.getJSONObject(i).getString("code");
			if (i % 500 == 0 && i != 0) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == jsonarry.size() - 1) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray jsonall = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray jsona = getCcc(lists.get(i), 1f);
			jsonall.addAll(jsona);
		}

		for (int i = 0; i < jsonarry.size(); i++) {
			String code = jsonarry.getJSONObject(i).getString("code");
			for (int j = 0; j < jsonall.size(); j++) {
				String code1 = jsonall.getJSONObject(j).getString("code");
				if (code.equals(code1)) {
					jsonarry.getJSONObject(i).put("jiege", jsonall.getJSONObject(j).get("jiege"));
					jsonarry.getJSONObject(i).put("jinkai", jsonall.getJSONObject(j).get("jinkai"));
					jsonarry.getJSONObject(i).put("huanshoulv", jsonall.getJSONObject(j).get("huanshoulv"));
					jsonarry.getJSONObject(i).put("zhangdiefu", jsonall.getJSONObject(j).get("zhangdiefu"));
					jsonarry.getJSONObject(i).put("zuidi", jsonall.getJSONObject(j).get("zuidi"));
					break;
				}
			}
		}

		return convertJSONArrayToHTMLTable(jsonarry);
	}
	
	@GetMapping("/getTop1001")
	@ResponseBody
	@Transactional
	public String getTop1001(HttpServletRequest req) {

		String gn = req.getParameter("gn");

		if (gn == null || "".equals(gn)) {
			gn = "";
		}

		JSONObject json = new JSONObject();
		json.put("gn", gn);

		JSONArray jsonarry = this.stockQS.getTop1001(json);

		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < jsonarry.size(); i++) {
			String code = jsonarry.getJSONObject(i).getString("code");
			if (i % 500 == 0 && i != 0) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == jsonarry.size() - 1) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray jsonall = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray jsona = getCcc(lists.get(i), 1f);
			jsonall.addAll(jsona);
		}

		for (int i = 0; i < jsonarry.size(); i++) {
			String code = jsonarry.getJSONObject(i).getString("code");
			for (int j = 0; j < jsonall.size(); j++) {
				String code1 = jsonall.getJSONObject(j).getString("code");
				if (code.equals(code1)) {
					jsonarry.getJSONObject(i).put("jiege", jsonall.getJSONObject(j).get("jiege"));
					jsonarry.getJSONObject(i).put("jinkai", jsonall.getJSONObject(j).get("jinkai"));
					jsonarry.getJSONObject(i).put("huanshoulv", jsonall.getJSONObject(j).get("huanshoulv"));
					jsonarry.getJSONObject(i).put("zhangdiefu", jsonall.getJSONObject(j).get("zhangdiefu"));
					jsonarry.getJSONObject(i).put("zuidi", jsonall.getJSONObject(j).get("zuidi"));
					break;
				}
			}
		}

		return convertJSONArrayToHTMLTable(jsonarry);
	}

	@GetMapping("/getTopBanList1")
	@ResponseBody
	@Transactional
	public String getTopBanList1(HttpServletRequest req) {

		// System.out.println("map1==" + SB1.map1.size());
		SB1.map1.sort((s1, s2) -> Double.compare(s2.getZdf(), s1.getZdf()));

		if (SB1.map1.size() > 20) {
			SB1.map1 = SB1.map1.subList(0, 20);
		}
		for (int i = 0; i < SB1.map1.size(); i++) {
			if (SB1.map1.get(i).getZdf() >= 1) {
				this.stockQS.save(SB1.map1.get(i), 1);
			}
			String code = SB1.map1.get(i).getCode();
			for (int j = 0; j < SB1.listall.size(); j++) {
				String code1 = SB1.listall.get(j).getName();
				if (code.equals(code1)) {
					SB1.map1.get(i).setSsgn(SB1.listall.get(j).getGn());
					break;
				}

			}
		}

		JSONArray jsonarry = JSONArray.fromObject(SB1.map1);

		return convertJSONArrayToHTMLTable(jsonarry);
	}

	@GetMapping("/getTopBanList3")
	@ResponseBody
	@Transactional
	public String getTopBanList3(HttpServletRequest req) {

		// System.out.println("map3==" + SB1.map3.size());
		SB1.map3.sort((s1, s2) -> Double.compare(s2.getZdf(), s1.getZdf()));

		if (SB1.map3.size() > 20) {
			SB1.map3 = SB1.map3.subList(0, 20);
		}

		for (int i = 0; i < SB1.map3.size(); i++) {
			if (SB1.map3.get(i).getZdf() >= 1.5) {
				this.stockQS.save(SB1.map3.get(i), 3);
			}
			String code = SB1.map3.get(i).getCode();
			for (int j = 0; j < SB1.listall.size(); j++) {
				String code1 = SB1.listall.get(j).getName();
				if (code.equals(code1)) {
					SB1.map3.get(i).setSsgn(SB1.listall.get(j).getGn());
					break;
				}

			}
		}

		JSONArray jsonarry = JSONArray.fromObject(SB1.map3);

		return convertJSONArrayToHTMLTable(jsonarry);
	}

	@GetMapping("/getTopBanList5")
	@ResponseBody
	@Transactional
	public String getTopBanList5(HttpServletRequest req) {

		// System.out.println("5分钟之内的首版");

		// System.out.println("map5==" + SB1.map5.size());
		SB1.map5.sort((s1, s2) -> Double.compare(s2.getZdf(), s1.getZdf()));

		if (SB1.map5.size() > 20) {

			SB1.map5 = SB1.map5.subList(0, 20);
		}
		for (int i = 0; i < SB1.map5.size(); i++) {
			if (SB1.map5.get(i).getZdf() >= 2) {
				this.stockQS.save(SB1.map5.get(i), 5);
			}
			String code = SB1.map5.get(i).getCode();
			for (int j = 0; j < SB1.listall.size(); j++) {
				String code1 = SB1.listall.get(j).getName();
				if (code.equals(code1)) {
					SB1.map5.get(i).setSsgn(SB1.listall.get(j).getGn());
					break;
				}

			}
		}
		JSONArray jsonarry = JSONArray.fromObject(SB1.map5);

		return convertJSONArrayToHTMLTable(jsonarry);
	}

	@GetMapping("/getTopShouban")
	@ResponseBody
	@Transactional
	public void getTopShouban(HttpServletRequest req) {
		for (int i = 0; i < SB1.listsu.size(); i++) {
			SB1.listsu.get(i).stop();
		}
		SB1.map1.clear();
		SB1.map3.clear();
		SB1.map5.clear();
		if (sbflag == false) {
			StockDataUpdater2 updater = new StockDataUpdater2();
			Thread updateThread = new Thread(updater);
			SB1.listsu.add(updateThread);
			updateThread.start();
			sbflag = true;
		}
	}

	@GetMapping("/getLonghuitou")
	@ResponseBody
	@Transactional
	public String getLonghuitou(HttpServletRequest req) {

		JSONObject json = new JSONObject();
		JSONArray jsonall = this.stockQS.getLonghuitou(json);

		return convertJSONArrayToHTMLTable(jsonall);
	}

	@GetMapping("/getJinriFenxi")
	@ResponseBody
	@Transactional
	public String getJinriFenxi(HttpServletRequest req) {

		JSONObject json = new JSONObject();
		List<String> list = stockService.getallCode();
		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < list.size(); i++) {
			String code = list.get(i);
			if (i % 500 == 0 && i != 0) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == list.size() - 1) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray jsonall = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray jsona = getCcc(lists.get(i), 1f);
			jsonall.addAll(jsona);
		}
		List<String> list2 = new ArrayList<String>();
		for (int i = jsonall.size() - 1; i >= 0; i--) {

			if (Float.parseFloat(jsonall.getJSONObject(i).getString("zhangdiefu")) > 7f) {
				list2.add(jsonall.getJSONObject(i).getString("code").replace("sz", "").replace("sh", ""));
			} else {
				jsonall.remove(i);
			}

		}

		List<StockCls> list3 = stockQS.getZhuijinlaCls1(jsonall);

		if (list3 == null) {

			return "";
		}

		for (int i = jsonall.size() - 1; i >= 0; i--) {
			String code = jsonall.getJSONObject(i).getString("code").replace("sz", "").replace("sh", "");
			boolean b = false;
			for (int j = 0; j < list3.size(); j++) {
				if (code.equals(list3.get(j).getCode())) {
					jsonall.getJSONObject(i).put("gn", list3.get(j).getGn());
					jsonall.getJSONObject(i).put("ztContent", list3.get(j).getZtContent());
					b = true;
					break;
				}
			}
			jsonall.getJSONObject(i).put("cjje", Float.parseFloat(jsonall.getJSONObject(i).get("cjje").toString()) / 10000f);

			if (b == false) {
				jsonall.remove(i);
			}
		}

		return convertJSONArrayToHTMLTable(jsonall);
	}

	@GetMapping("/getZuiJinfanla")
	@ResponseBody
	@Transactional
	public String getZuiJinfanla(HttpServletRequest req) {

		JSONObject json = new JSONObject();
		json.put("text17", req.getParameter("text17"));
		json.put("text18", req.getParameter("text18"));
		json.put("text19", req.getParameter("text19"));
		List<String> list = stockQS.getZuiJinfanla(req.getParameter("text18"));
		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < list.size(); i++) {
			String code = list.get(i);
			if (i % 500 == 0 && i != 0) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == list.size() - 1) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray jsonall = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray jsona = getCcc(lists.get(i), 1f);
			jsonall.addAll(jsona);
		}
		for (int i = jsonall.size() - 1; i >= 0; i--) {
			JSONObject json1 = jsonall.getJSONObject(i);
			try {

				Float zuidi = Float.parseFloat((String) json1.get("zuidi"));
				Float jiage = Float.parseFloat((String) json1.get("jiage"));
				Float jinkai = Float.parseFloat((String) json1.get("jinkai"));

				if (jiage > zuidi && zuidi < jinkai && jiage >= jinkai * 0.97) {

					Float xiayin = (jiage - zuidi) / jinkai;
					json1.put("xiaying", xiayin);
				} else {
					json1.put("xiaying", 0);
				}

//				if (jinkai > zuidi * Float.parseFloat(req.getParameter("text17")) && jiage > zuidi * Float.parseFloat(req.getParameter("text17"))) {
//
//				} else {
//					jsonall.remove(i);
//				}
			} catch (Exception e) {
				System.out.println("1jin2涨跌幅转换错误");
			}

		}
		List<String> list2 = new ArrayList<String>();
		for (int i = 0; i < jsonall.size(); i++) {
			list2.add(jsonall.getJSONObject(i).getString("code").replace("sz", "").replace("sh", ""));
		}

		List<StockCls> list3 = stockQS.getZhuijinlaCls(jsonall, req.getParameter("text19"));

		if (list3 == null) {

			return "";
		}

		for (int i = jsonall.size() - 1; i >= 0; i--) {
			String code = jsonall.getJSONObject(i).getString("code").replace("sz", "").replace("sh", "");
			boolean b = false;
			for (int j = 0; j < list3.size(); j++) {
				if (code.equals(list3.get(j).getCode())) {
					jsonall.getJSONObject(i).put("gn", list3.get(j).getGn());
					jsonall.getJSONObject(i).put("ztContent", list3.get(j).getZtContent());
					b = true;
					break;
				}
			}
			jsonall.getJSONObject(i).put("cjje", Float.parseFloat(jsonall.getJSONObject(i).get("cjje").toString()) / 10000f);

			if (b == false) {
				jsonall.remove(i);
			}
		}

		return convertJSONArrayToHTMLTable(jsonall);
	}

	@GetMapping("/get1jin2")
	@ResponseBody
	@Transactional
	public String get1jin2(HttpServletRequest req) {

		JSONObject json = new JSONObject();
		json.put("text14", req.getParameter("text14"));
		json.put("text15", req.getParameter("text15"));
		List<String> list = stockQS.get1jin2(json);

		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < list.size(); i++) {
			String code = list.get(i);
			if (i % 500 == 0 && i != 0) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == list.size() - 1) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray jsonall = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray jsona = getCcc(lists.get(i), 1f);
			jsonall.addAll(jsona);
		}
		for (int i = jsonall.size() - 1; i >= 0; i--) {
			JSONObject json1 = jsonall.getJSONObject(i);
			try {
				if (Float.parseFloat((String) json1.get("zhangdiefu")) >= 4f) {

				} else {
					jsonall.remove(i);
				}
			} catch (Exception e) {
				System.out.println("1jin2涨跌幅转换错误");
			}

		}
		List<String> list2 = new ArrayList<String>();
		for (int i = 0; i < jsonall.size(); i++) {
			list2.add(jsonall.getJSONObject(i).getString("code").replace("sz", "").replace("sh", ""));
		}

		List<StockCls> list3 = stockQS.get1jin2Cls(list2);

		for (int i = jsonall.size() - 1; i >= 0; i--) {
			String code = jsonall.getJSONObject(i).getString("code").replace("sz", "").replace("sh", "");
			boolean b = false;
			for (int j = 0; j < list3.size(); j++) {
				if (code.equals(list3.get(j).getCode())) {
					jsonall.getJSONObject(i).put("gn", list3.get(j).getGn());
					b = true;
					break;
				}
			}
			jsonall.getJSONObject(i).put("cjje", Float.parseFloat(jsonall.getJSONObject(i).get("cjje").toString()) / 10000f);
			if (b == false) {
				jsonall.remove(i);
			}

		}

		return convertJSONArrayToHTMLTable(jsonall);
	}

	@PostMapping("/addModelContent2jin3")
	@ResponseBody
	@Transactional
	public JSONObject addModelContent2jin3(HttpServletRequest req) {
		JSONArray json = new JSONArray();

		String arr = req.getParameter("arr");

		JSONArray jsonarr = JSONArray.fromObject(arr);

		List<Model2jin3> list = JSONArray.toList(jsonarr, Model2jin3.class);

		JSONArray map = stockQS.addModelContent2jin3(jsonarr);
		JSONObject jsonObject1 = JSONObject.fromObject("{message:1}");

		return jsonObject1;
	}

	@GetMapping("/getmodel2jin3")
	@ResponseBody
	@Transactional
	public String getmodel2jin3(HttpServletRequest req) {

		JSONArray json = new JSONArray();
		JSONArray map = stockQS.getmodel2jin3(json);

		return convertJSONArrayToHTMLTable(map);
	}

	@GetMapping("/getQS")
	@ResponseBody
	@Transactional
	public String getQS(HttpServletRequest req) {

		JSONArray map = stockQS.getQS();

		return convertJSONArrayToHTMLTable(map);
	}

	@GetMapping("/getztConentCode")
	@ResponseBody
	@Transactional
	public String getztConentCode(HttpServletRequest req) {

		JSONObject json = new JSONObject();

		String text1 = req.getParameter("text1").replace("，", ",");

		if (text1 == null) {
			return null;
		}

		String str[] = text1.split(",");

		for (int i = 0; i < str.length; i++) {
			if (i == 0) {
				json.put("g0", str[0]);
			}
			if (i == 1) {
				json.put("g1", str[1]);
			}
			if (i == 2) {
				json.put("g2", str[2]);
			}
			if (i == 3) {
				json.put("g3", str[3]);
			}
		}

		JSONArray map = stockQS.getztConentCode(json);

		return convertJSONArrayToHTMLTable(map);
	}

	@PostMapping("/add2jin3")
	@ResponseBody
	@Transactional
	public JSONObject add2jin3(HttpServletRequest req) {
		JSONArray json = new JSONArray();

		String arr = req.getParameter("arr");

		String groupname = req.getParameter("groupname");

		JSONArray arr1 = JSONArray.fromObject(arr);

		for (int i = 0; i < arr1.size(); i++) {

			JSONObject json1 = arr1.getJSONObject(i);

			if (json1.containsKey("code")) {
				JSONObject json2 = new JSONObject();
				json2.put("code1", json1.getString("code"));
				json2.put("name1", json1.getString("name1"));
				json2.put("group1", groupname);
				stockService.addLTmodel(json2);
			}
			;
		}

		JSONObject jsonObject1 = JSONObject.fromObject("{message:1}");
		return jsonObject1;
	}

	@GetMapping("/addChanping")
	@ResponseBody
	@Transactional
	public JSONObject addChanping(HttpServletRequest req) {
		stock.addChanping();
		JSONObject jsonObject = JSONObject.fromObject("{message:1}");
		return jsonObject;
	}

	@GetMapping("/addGNShiZhi")
	@ResponseBody
	@Transactional
	public JSONObject addGNShiZhi(HttpServletRequest req) {
		stock.addGNShiZhi();
		JSONObject jsonObject = JSONObject.fromObject("{message:1}");
		return jsonObject;
	}

	@GetMapping("/addSHList")
	@ResponseBody
	@Transactional
	public JSONObject addSHList(HttpServletRequest req) {
		stock.addSH();
		JSONObject jsonObject = JSONObject.fromObject("{message:1}");
		return jsonObject;
	}

	@GetMapping("/addSHList1")
	@ResponseBody
	@Transactional
	public JSONObject addSHList1(HttpServletRequest req) {
		stock.addSH1();
		JSONObject jsonObject = JSONObject.fromObject("{message:1}");
		return jsonObject;
	}

	@GetMapping("/addszList")
	@ResponseBody
	@Transactional
	public JSONObject addszList(HttpServletRequest req) {
		stock.addSz();
		JSONObject jsonObject = JSONObject.fromObject("{message:1}");
		return jsonObject;
	}

	@GetMapping("/addCls")
	@ResponseBody
	@Transactional
	public JSONObject addCls(HttpServletRequest req) {
		stockClsService.getStocCls1();
		JSONObject jsonObject = JSONObject.fromObject("{message:1}");
		return jsonObject;
	}

	@GetMapping("/addszList1")
	@ResponseBody

	public JSONObject addszList1(HttpServletRequest req) {
		stock.addSz1();
		JSONObject jsonObject = JSONObject.fromObject("{message:1}");
		return jsonObject;
	}

	@GetMapping("/addszList2")
	@ResponseBody

	public JSONObject addszList2(HttpServletRequest req) {
		stock.addSz2();
		JSONObject jsonObject = JSONObject.fromObject("{message:1}");
		return jsonObject;
	}

	@GetMapping("/deleteSH")
	@ResponseBody
	public JSONObject deleteSH(HttpServletRequest req) {
		stock.deleteSH();
		JSONObject jsonObject = JSONObject.fromObject("{message:1}");
		return jsonObject;
	}

	@GetMapping("/getSelect")
	@ResponseBody
	public JSONArray getSelect(HttpServletRequest req) {
		// int date = Integer.valueOf(req.getParameter("date"));
		int zhang = Integer.valueOf(req.getParameter("zhang"));
		Integer num = 20230000;
		List<JSONObject> list = stockselect.getOne(num, zhang);
		JSONArray jsonObject = JSONArray.fromObject(list);
		return jsonObject;
	}

	@GetMapping("/getSelect1")
	@ResponseBody
	public JSONArray getSelect1(HttpServletRequest req) {
		int date = Integer.valueOf(req.getParameter("date1"));
		List<JSONObject> list = stockselect.getSelect1(date);
		JSONArray jsonObject = JSONArray.fromObject(list);
		return jsonObject;
	}

	@GetMapping("/getSelect2")
	@ResponseBody
	public JSONObject getSelect2(HttpServletRequest req) {
		int date = 0;
		if (null != req.getParameter("date2") && !"".equals(req.getParameter("date2"))) {
			date = Integer.valueOf(req.getParameter("date2"));
		}
		stockSuanFa.zhang_die5(5f, 5f);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("msg", "计算成功");
		return jsonObject;
	}

	@GetMapping("/getContent")
	@ResponseBody
	public JSONArray getContent(HttpServletRequest req) {
		List<StockContent> list = stockselect.getContent();
		JSONArray jsonObject = JSONArray.fromObject(list);
		return jsonObject;
	}

	@PostMapping("/addpinfen")
	@ResponseBody
	public JSONObject addpinfen(HttpServletRequest req) {

		String all = req.getParameter("all");
		JSONArray jsonArray = JSONArray.fromObject(all);
		JSONObject jsonObject = new JSONObject();
		List<StockContent> list = stockselect.addpinfen(jsonArray);
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/getPinfen")
	@ResponseBody
	public JSONArray getPinfen(HttpServletRequest req) {
		List<StockCode> list = stockselect.getPinfen();
		JSONArray jsonObject = JSONArray.fromObject(list);
		return jsonObject;
	}

	@GetMapping("/changeZX")
	@ResponseBody
	public JSONObject changeZX(HttpServletRequest req) {
		String code = req.getParameter("code");
		String state = req.getParameter("state");
		List<StockCode> list = stockselect.changeZX(code, state);
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/getStockNote")
	@ResponseBody
	public String getStockNote(HttpServletRequest req) {

		List<StockCode> list = stockselect.getStockNote();

		String str = convertJSONArrayToHTMLTable(JSONArray.fromObject(list));

		return str;
	}

	@GetMapping("/getStocCls")
	@ResponseBody
	public JSONObject getStocCls(HttpServletRequest req) {

		stockClsService.getStocCls();

		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/getDRfenqi")
	@ResponseBody
	public String getDRfenqi(HttpServletRequest req) {

		List<String> list = stockService.getallCode();
		String qianyitian = req.getParameter("qianyitian");
		String flag = req.getParameter("flag");
		String text10 = req.getParameter("text10");
		String text8 = req.getParameter("text8");
		String text9[] = req.getParameter("text9").split("-");
		String allcode = "";
		List<String> lists = new ArrayList<String>();
		for (int i = 0; i < list.size(); i++) {

			if (i % 500 == 0 && i != 0) {
				allcode += list.get(i) + "";
				System.out.println(allcode);
				lists.add(allcode);
				allcode = "";
				continue;
			}
			if (i == list.size() - 1) {
				allcode += list.get(i) + "";
				System.out.println(allcode);
				lists.add(allcode);
				break;
			}
			if (i == list.size() - 1) {
				allcode += list.get(i);
			} else {
				allcode += list.get(i) + ",";
			}
		}
		JSONArray json = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray json1 = FQList(lists.get(i), Float.parseFloat(text8), text9, 0f);
			if (json1 == null) {
				continue;
			}
			System.out.println("符合Fq长度：" + json1.size());
			json.addAll(json1);
		}
		List<String> list2 = new ArrayList<String>();
		for (int i = 0; i < json.size(); i++) {
			list2.add(json.getJSONObject(i).getString("code").replace("sz", "").replace("sh", ""));
		}
		JSONArray json1 = this.sunFa4.getGN(list2);
		for (int i = 0; i < json1.size(); i++) {
			for (int j = 0; j < json.size(); j++) {
				String code = json.getJSONObject(j).getString("code").replace("sz", "").replace("sh", "");
				if (json1.getJSONObject(i).getString("code").equals(code)) {
					json1.getJSONObject(i).put("zuigao", json.getJSONObject(j).getString("zuigao"));
					json1.getJSONObject(i).put("zuidi", json.getJSONObject(j).getString("zuidi"));
					json1.getJSONObject(i).put("huanshoulv", json.getJSONObject(j).getString("huanshoulv"));
					json1.getJSONObject(i).put("jiage", json.getJSONObject(j).getString("jiage"));
					json1.getJSONObject(i).put("zhangdiefu", json.getJSONObject(j).getString("zhangdiefu"));
					break;
				}

			}
		}
		for (int i = json1.size() - 1; i >= 0; i--) {
			JSONObject jsonx = json1.getJSONObject(i);

			if ("0".equals(flag)) {
				if (Float.parseFloat(jsonx.getString("huanshoulv")) / Float.parseFloat(jsonx.getString("cjlsum")) > Float.parseFloat(text10)) {
					json1.remove(i);
					continue;
				}
			}
			if ("1".equals(flag)) {
				if (Float.parseFloat(jsonx.getString("huanshoulv")) / Float.parseFloat(jsonx.getString("cjlsum")) < Float.parseFloat(text10)) {
					json1.remove(i);
					continue;
				}
			}
			if (Float.parseFloat(jsonx.getString("zuijinZDF")) >= 5f || Float.parseFloat(jsonx.getString("zuijinZDF")) <= -3f) {
				json1.remove(i);
				continue;
			}

			jsonx.put("liangbi", Float.parseFloat(jsonx.getString("huanshoulv")) / Float.parseFloat(jsonx.getString("cjlsum")));

		}
		System.out.println("当前换手率》昨天换手率的：" + json1.size());
		if (json1.size() <= 0) {
			return "";
		}

		return convertJSONArrayToHTMLTable(json1);
	}

	@GetMapping("/getStockQQ")
	@ResponseBody
	public String getStockQQ(HttpServletRequest req) {

		stockQQService.getStockQQ();

		return "";
	}

	@GetMapping("/getGnStockList")
	@ResponseBody
	public String getGnStockList(HttpServletRequest req) {

		String str = req.getParameter("text5");
		JSONObject json = new JSONObject();
		json.put("text5", str);
		JSONArray arr = stockClsService.getGnStockList(json);

		String str1 = convertJSONArrayToHTMLTable(arr);
		return str1;
	}

	@PostMapping("/getNote1")
	@ResponseBody
	public JSONArray getNote1(HttpServletRequest req) {
		String codeall = req.getParameter("code");
		JSONArray list = stockselect.getStockNote(codeall);
		return list;
	}

	@GetMapping("/addGN")
	@ResponseBody
	public JSONObject addGN(HttpServletRequest req) {
		stockService.addGN();
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@PostMapping("/addstockpcitrue")
	@ResponseBody
	public JSONObject addstockpcitrue(HttpServletRequest req) {
		String all = req.getParameter("all");
		List<StockPcitrue> list = (List<StockPcitrue>) JSONArray.toCollection(JSONArray.fromObject(all), StockPcitrue.class);
		stockService.addstockpcitrue(list);
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/testSH")
	@ResponseBody
	public JSONObject testSH(HttpServletRequest req) {
		testSHFace.testSH(req.getParameter("str"));
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/addHS")
	@ResponseBody
	public JSONObject addHS(HttpServletRequest req) {
		stockService.getCJL();
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/addNote")
	@ResponseBody
	public JSONObject addNote(HttpServletRequest req) {
		String str = req.getParameter("note");
		JSONArray json = JSONArray.fromObject(str);
		stockService.addNote(json);
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/addLTmodel")
	@ResponseBody
	public JSONObject addLTmodel(HttpServletRequest req) {
		String code = req.getParameter("code");
		String group = req.getParameter("group");
		JSONObject json = new JSONObject();
		json.put("code1", code);
		json.put("group1", group);
		stockService.addLTmodel(json);
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/deleteLTmodel")
	@ResponseBody
	public JSONObject deleteLTmodel(HttpServletRequest req) {
		String code = req.getParameter("code");
		String group = req.getParameter("group");
		JSONObject json = new JSONObject();
		json.put("code1", code);
		json.put("group1", group);
		stockService.deleteLTmodel(json);
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/getCJ20")
	@ResponseBody
	public String getCJ20(HttpServletRequest req) {
		String text11 = req.getParameter("text11");
		String text12 = req.getParameter("text12");
		String text13 = req.getParameter("text13");
		JSONObject json = new JSONObject();
		List<String> list = stockService.getallCode();

		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < list.size(); i++) {
			String code = list.get(i);
			if (i % 500 == 0 && i != 0) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == list.size() - 1) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray jsonall = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray jsona = getCcc(lists.get(i), 1f);
			jsonall.addAll(jsona);
		}
		// System.out.println(jsonall.toString());

		for (int i = jsonall.size() - 1; i >= 0; i--) {

			JSONObject json1 = jsonall.getJSONObject(i);
			if (Float.parseFloat(json1.getString("cjje")) <= Float.parseFloat(text13) * 10000) {
				jsonall.remove(i);
				continue;
			}
			if (Float.parseFloat(json1.getString("shizhi")) > Float.parseFloat(text12) || Float.parseFloat(json1.getString("shizhi")) < Float.parseFloat(text11)) {
				jsonall.remove(i);
				continue;
			}

		}

		List<String> listx = new ArrayList<String>();
		for (int i = 0; i < jsonall.size(); i++) {
			jsonall.getJSONObject(i).put("cjje", (Float.parseFloat(jsonall.getJSONObject(i).get("cjje") + "") / 10000 + "").replaceAll("\\..*", "") + "亿");
			listx.add(jsonall.getJSONObject(i).getString("code").replace("sz", "").replace("sh", ""));
		}

		JSONArray arr1 = this.sunFa4.getGN(listx);

		for (int i = 0; i < jsonall.size(); i++) {
			for (int j = 0; j < arr1.size(); j++) {
				if (jsonall.getJSONObject(i).getString("code").replace("sz", "").replace("sh", "").equals(arr1.getJSONObject(j).getString("code"))) {
					jsonall.getJSONObject(i).put("ztContent", arr1.getJSONObject(j).getString("ztContent"));
					jsonall.getJSONObject(i).put("gn", arr1.getJSONObject(j).getString("gn"));
					continue;
				}

			}
		}

		String str = convertJSONArrayToHTMLTable(JSONArray.fromObject(jsonall));
		return str;
	}

	@GetMapping("/execZTcontent")
	@ResponseBody
	public JSONObject execZTcontent(HttpServletRequest req) {
		String code = req.getParameter("code");
		String group = req.getParameter("group");
		JSONObject json = new JSONObject();
		json.put("code1", code);
		json.put("group1", group);
		stockClsService.getStocCls2();
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/execZTcontent1")
	@ResponseBody
	public JSONObject execZTcontent1(HttpServletRequest req) {
		String code = req.getParameter("code");
		String group = req.getParameter("group");
		JSONObject json = new JSONObject();
		json.put("code1", code);
		json.put("group1", group);
		stockClsService.getStocCls21();
		JSONObject jsonObject1 = JSONObject.fromObject("{msg:0}");
		return jsonObject1;
	}

	@GetMapping("/getLTmodel")
	@ResponseBody
	public JSONArray getLTmodel(HttpServletRequest req) {
		// String code = req.getParameter("code");

		JSONArray list = this.stockService.getLt();

		String allcode = "";
		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < list.size(); i++) {
			String code = list.getJSONObject(i).getString("code1");
			if (code.indexOf("6") == 0) {
				code = "sh" + code;
			} else {
				code = "sz" + code;
			}
			if (i % 400 == 0 && i != 0) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == list.size() - 1) {
				all += code + "";
				// System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray array = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			System.out.println(lists.get(i).split(",").length);
			JSONArray array1 = getCcc(lists.get(i), 0f);
			System.out.println("符合Fq长度：" + array1.size());
			array.addAll(array1);
		}

		for (int i = 0; i < list.size(); i++) {
			JSONObject a = list.getJSONObject(i);
			for (int j = 0; j < array.size(); j++) {
				JSONObject b = array.getJSONObject(j);
				if (b.getString("code").indexOf(a.getString("code1")) > -1) {
					a.put("zhangdiefu", b.getString("zhangdiefu"));
					a.put("jiage", b.getString("jiage"));
					a.put("huanshoulv", b.getString("huanshoulv"));
					a.put("name1", b.getString("name"));
					a.put("cjje", b.getString("cjje"));
					// System.out.println(b.getString("code") + ":" + b.getString("cjje"));
					a.put("shizhi", b.getString("shizhi").replaceAll("\\..*", ""));
					a.put("ztContent", a.getString("ztContent"));
					break;
				}
			}

		}

		for (int i = list.size() - 1; i >= 0; i--) {

			JSONObject a = list.getJSONObject(i);
			if (a.containsKey("cjje")) {

			} else {
				list.remove(i);
			}

		}

		Comparator<JSONObject> comparator = (jsonObject1, jsonObject2) -> Double.compare(Float.parseFloat(jsonObject1.getString("cjje")), Float.parseFloat(jsonObject2.getString("cjje")));
		list.sort(comparator);

		return list;
	}

	@GetMapping("/getdisSp")
	@ResponseBody
	public JSONArray getdisSp(HttpServletRequest req) {

		List<String> list = stockService.getdisSp();
		JSONArray jsonObject1 = JSONArray.fromObject(list);
		return jsonObject1;
	}

	@GetMapping("/getsp")
	@ResponseBody
	public String getsp(HttpServletRequest req) {
		String sp = req.getParameter("sp");
		List<StockPcitrue> list = stockService.getdisSp(sp);

		String allcode = "";
		for (int i = 0; i < list.size(); i++) {

			if (i == list.size() - 1) {
				allcode += list.get(i).getCode();
			} else {
				allcode += list.get(i).getCode() + ",";
			}
		}
		JSONArray json = getCcc(allcode, 0f);
		int zhang = 0;
		int die = 0;
		for (int i = 0; i < json.size(); i++) {
			JSONObject jsonobj = json.getJSONObject(i);
			String code = jsonobj.getString("code");
			for (int j = 0; j < list.size(); j++) {
				if (code.equals(list.get(j).getCode())) {
					// jsonobj.put("kuizhaoJiage", list.get(j).getJiage());
					// jsonobj.put("kuizhaoHuanshoulv",list.get(j).getHuanshoulv());
					// jsonobj.put("kuizhaoZhangdiefu", list.get(j).getZhangdiefu());
					if (Float.parseFloat(jsonobj.getString("jiage")) >= Float.parseFloat(list.get(j).getJiage())) {
						jsonobj.put("state", "<font color=red>上涨中</font>");
						zhang++;
					} else {
						jsonobj.put("state", "<font color=green>下跌中</font>");
						die++;
					}
					jsonobj.put("zhangdiefu", "<font color=red>当前：" + jsonobj.getString("zhangdiefu") + "</font>--快照：" + list.get(j).getZhangdiefu());
					jsonobj.put("jiage", "<font color=red>当前：" + jsonobj.getString("jiage") + "</font>--快照：" + list.get(j).getJiage());
					jsonobj.put("huanshoulv", "<font color=red>当前：" + jsonobj.getString("huanshoulv") + "</font>--快照：" + list.get(j).getHuanshoulv());
					break;
				}
			}
		}
		String str = "";
		str += "<div><b>涨：" + zhang + "  跌：" + die + "</b></div>" + convertJSONArrayToHTMLTable(json);
		return str;
	}

	@GetMapping("/getMeiTianChao70baifen10dian")
	@ResponseBody
	public String getMeiTianChao70baifen10dian(HttpServletRequest req) {

		JSONArray list = stockselect.getStockCT5();
		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < list.size(); i++) {
			JSONObject json = list.getJSONObject(i);
			String diqv = json.getString("diqv");
			String code = json.getString("code");
			if ("0".equals(diqv)) {
				code = "sh" + code;
			} else {
				code = "sz" + code;
			}
			if (i % 500 == 0 && i != 0) {
				all += code + "";
				System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == list.size() - 1) {
				all += code + "";
				System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray jsonall = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray jsona = getCcc(lists.get(i), 1f);
			jsonall.addAll(jsona);
		}
		System.out.println(jsonall.size());
		for (int i = 0; i < list.size(); i++) {
			JSONObject json = list.getJSONObject(i);
			String diqv = json.getString("diqv");
			String code = json.getString("code");
			if ("0".equals(diqv)) {
				code = "sh" + code;
			} else {
				code = "sz" + code;
			}
			for (int j = 0; j < jsonall.size(); j++) {
				JSONObject json1 = jsonall.getJSONObject(j);
				String code1 = json1.getString("code");
				if (code1.equals(code)) {
					json1.put("huanshoulv0", json.getString("huanshoulv"));
					json1.put("beisu", Float.parseFloat(json1.getString("huanshoulv")) / Float.parseFloat(json.getString("huanshoulv")));
					break;
				}
			}
		}

		String str = convertJSONArrayToHTMLTable(JSONArray.fromObject(jsonall));
		return str;
	}

	/**
	 * 查询当前最新的qq数据
	 * 
	 * @param req
	 * @return
	 */
	@GetMapping("/getStockCT5")
	@ResponseBody
	public String getStockCT5(HttpServletRequest req) {
		JSONArray list = stockselect.getStockCT5();
		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < list.size(); i++) {
			JSONObject json = list.getJSONObject(i);
			String diqv = json.getString("diqv");
			String code = json.getString("code");
			if ("0".equals(diqv)) {
				code = "sh" + code;
			} else {
				code = "sz" + code;
			}
			if (i % 500 == 0 && i != 0) {
				all += code + "";
				System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == list.size() - 1) {
				all += code + "";
				System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray jsonall = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray jsona = getCcc(lists.get(i), 1f);
			jsonall.addAll(jsona);
		}
		String str = convertJSONArrayToHTMLTable(JSONArray.fromObject(jsonall));
		return str;
	}

	@PostMapping("/getStockCT5GN")
	@ResponseBody
	public JSONArray getStockCT5GN(HttpServletRequest req) {
		String code = req.getParameter("code");
		System.out.println(code);
		JSONArray j = this.stockselect.getStock5GN(code);
		return j;
	}

	@GetMapping("/getHsldizengDay")
	@ResponseBody
	public String getHsldizengDay(HttpServletRequest req) {
		String hsl = req.getParameter("hsl");
		String day = req.getParameter("day");
		String jiage = req.getParameter("jiage");
		String select = req.getParameter("select");
		String bo1 = req.getParameter("bo1");
		String bo2 = req.getParameter("bo2");
		JSONArray list = this.stockselect.getHsldizengDay(hsl, day, jiage, select, bo1, bo2);
		List<String> lists = new ArrayList<String>();
		String all = "";
		for (int i = 0; i < list.size(); i++) {
			JSONObject json = list.getJSONObject(i);
			String diqv = json.getString("diqv");
			String code = json.getString("code");
			if ("0".equals(diqv)) {
				code = "sh" + code;
			} else {
				code = "sz" + code;
			}
			if (i % 500 == 0 && i != 0) {
				all += code + "";
				System.out.println(all);
				lists.add(all);
				all = "";
				continue;
			}
			if (i == list.size() - 1) {
				all += code + "";
				System.out.println(all);
				lists.add(all);
				break;
			}
			all += code + ",";
		}
		JSONArray jsonall = getCcc(all, 1f);
		String str = convertJSONArrayToHTMLTable(JSONArray.fromObject(jsonall));
		return str;

	}

	@PostMapping("/getzuijin")
	@ResponseBody
	public String getzuijin(HttpServletRequest req) {

		String day = req.getParameter("day");
		String zuixiaohuanshou = req.getParameter("zuixiaohuanshou");
		String zuixiaozhangdiefu = req.getParameter("zuixiaozhangdiefu");
		String zongzhangdiefu = req.getParameter("zongzhangdiefu");
		String flag = req.getParameter("flag");
		String chaju1 = req.getParameter("chaju1");
		String huanshou1 = req.getParameter("huanshou1");
		String danrizhangdiefu = req.getParameter("danrizhangdiefu");

		String str = "";
		if ("1".equals(flag)) {
			JSONArray j = this.stockService.getstockd(day, zuixiaohuanshou, zuixiaozhangdiefu, zongzhangdiefu);
			str = convertJSONArrayToHTMLTable(JSONArray.fromObject(j));
		}
		if ("3".equals(flag)) {
			JSONArray j = this.stockService.getstockdf(day, zuixiaohuanshou, zuixiaozhangdiefu, zongzhangdiefu);
			str = convertJSONArrayToHTMLTable(JSONArray.fromObject(j));
		}
		if ("4".equals(flag)) {
			JSONArray j = this.stockService.getstock2richaju(chaju1, danrizhangdiefu, zongzhangdiefu);
			str = convertJSONArrayToHTMLTable(JSONArray.fromObject(j));
		}

		if ("2".equals(flag)) {
			JSONArray json = this.stockService.getstockd(day, zuixiaohuanshou, zuixiaozhangdiefu, zongzhangdiefu);
			String codelist = "";
			for (int i = 0; i < json.size(); i++) {
				JSONObject obj = json.getJSONObject(i);
				String code = obj.getString("code");
				if (i == json.size() - 1) {
					codelist += code;
				} else {
					codelist += code + ",";
				}
			}
			System.out.println(codelist);
			JSONArray jc = getCcc(codelist, 0f);
			for (int j = jc.size() - 1; j >= 0; j--) {
				JSONObject obj = jc.getJSONObject(j);
				String code = obj.getString("code");

				for (int k = 0; k < json.size(); k++) {
					String code1 = json.getJSONObject(k).getString("code");
					Float f = Float.parseFloat(json.getJSONObject(k).getString("zhandifu"));
					if (code.equals(code1)) {
						if (Float.parseFloat(obj.get("zhangdiefu").toString()) + f > Float.parseFloat(zongzhangdiefu)) {
							jc.remove(j);
							break;
						}
					}
				}

				if (Float.parseFloat(obj.get("huanshoulv").toString()) < Float.parseFloat(zuixiaohuanshou)) {
					jc.remove(j);
					continue;
				}
			}

			str = convertJSONArrayToHTMLTable(jc);
		}
		return str;
	}

	@GetMapping("/get15dayLT")
	@ResponseBody
	public String get15dayLT(HttpServletRequest req) {

		JSONArray jsonaray = this.stockselect.get15dayLT();
		String str = convertJSONArrayToHTMLTable(jsonaray);
		return str;

	}

	@GetMapping("/getindex4CDate")
	@ResponseBody
	public JSONArray getindex4CDate(HttpServletRequest req) {
		String codeString = req.getParameter("all");
		String str[] = codeString.split(",");
		String codeall = "";
		for (int i = 0; i < str.length; i++) {
			String temp = str[i];
			if (temp.indexOf("6") == 0) {
				temp = "sh" + temp;
			} else {
				temp = "sz" + temp;
			}
			if (i == str.length - 1) {

				codeall += temp;
			} else {
				codeall += temp + ",";
			}
		}
		return getCcc(codeall, -1000f);

	}

	@GetMapping("/getFenQidayLT")
	@ResponseBody
	public String getFenQidayLT(HttpServletRequest req) {

		String flag = req.getParameter("flag");
		if ("-1".equals(flag)) {
			this.stockSelect1.getFenQidayLT(flag);
			return "";
		}

		this.stockselect.getFenQidayLT(flag);

		return "";

	}

	@GetMapping("/getFenQidayLTSelectDIS")
	@ResponseBody
	public JSONArray getFenQidayLTSelectDIS(HttpServletRequest req) {

		String flag = req.getParameter("flag");
		JSONArray j = this.stockselect.getFenQidayLTSelectDIS(flag);

		return j;

	}

	@GetMapping("/getFenQidayLTList")
	@ResponseBody
	public String getFenQidayLTList(HttpServletRequest req) {

		String createTime = req.getParameter("createTime");
		JSONArray json = this.stockselect.getFenQidayLTList(createTime);

		return convertJSONArrayToHTMLTable(json);

	}

	@GetMapping("/getjisuan2")
	@ResponseBody
	public String getjisuan2(HttpServletRequest req) {
		String flag = req.getParameter("flag");
		this.sunFa2.jisuan1(flag);

		return "";

	}

	@GetMapping("/getjisuan3")
	@ResponseBody
	public String getjisuan3(HttpServletRequest req) {
		String flag = req.getParameter("flag");
		this.sunFa3.jisuan1(flag);

		return "";

	}

	@GetMapping("/getSunfa2")
	@ResponseBody
	public String getSunfa2(HttpServletRequest req) {

		String createTime = req.getParameter("createTime");
		JSONArray json = this.sunFa2.getSunfa2(createTime);
		return convertJSONArrayToHTMLTable(json);

	}

	@GetMapping("/getSunfa3")
	@ResponseBody
	public String getSunfa3(HttpServletRequest req) {

		String createTime = req.getParameter("createTime");
		JSONArray json = this.sunFa3.getSunfa3(createTime);
		return convertJSONArrayToHTMLTable(json);

	}

	@GetMapping("/getSuanFa2select")
	@ResponseBody
	public JSONArray getSuanFa2select(HttpServletRequest req) {

		JSONArray j = this.sunFa2.getSuanFa2select(null);

		return j;

	}

	@GetMapping("/getSuanFa3select")
	@ResponseBody
	public JSONArray getSuanFa3select(HttpServletRequest req) {

		JSONArray j = this.sunFa3.getSuanFa2select(null);

		return j;

	}

	@GetMapping("/jisuan20")
	@ResponseBody
	public String jisuan20(HttpServletRequest req) {

		String day = req.getParameter("day");

		String chaju1 = req.getParameter("chaju1");
		String chaju2 = req.getParameter("chaju2");

		JSONObject json = new JSONObject();

		json.put("day", day);

		json.put("chaju1", chaju1);
		json.put("chaju2", chaju2);

		this.sunFa4.jisuan20(json);

		return "";
	}

	@GetMapping("/jisuan21")
	@ResponseBody
	public String jisuan21(HttpServletRequest req) {

		String day = req.getParameter("day");

		String chaju3 = req.getParameter("chaju3");
		String chaju4 = req.getParameter("chaju4");

		JSONObject json = new JSONObject();

		json.put("day", day);

		json.put("chaju3", chaju3);
		json.put("chaju4", chaju4);

		this.sunFa4.jisuan21(json);

		return "";
	}

	@GetMapping("/jisuan22")
	@ResponseBody
	public String jisuan22(HttpServletRequest req) {

		String day = req.getParameter("day");

		String chaju5 = req.getParameter("chaju5");
		String chaju6 = req.getParameter("chaju6");
		String chaju7 = req.getParameter("chaju7");
		JSONObject json = new JSONObject();

		json.put("day", day);

		json.put("chaju5", chaju5);
		json.put("chaju6", chaju6);
		json.put("chaju7", chaju7);
		this.sunFa4.jisuan22(json);

		return "";
	}

	@GetMapping("/jisuan23")
	@ResponseBody
	public String jisuan23(HttpServletRequest req) {

		String day3 = req.getParameter("day3");
		String day4 = req.getParameter("day4");
		String liang = req.getParameter("liang");
		String jia = req.getParameter("jia");
		JSONObject json = new JSONObject();

		json.put("day", day3);
		json.put("day1", day4);
		json.put("liang", liang);
		json.put("jia", jia);
		this.sunFa4.jisuan23(json);

		return "";
	}

	@GetMapping("/jisuan24")
	@ResponseBody
	public String jisuan24(HttpServletRequest req) {

		String day3 = req.getParameter("day5");
		String day4 = req.getParameter("day4");
		String liang = req.getParameter("liang");
		String jia = req.getParameter("jia");
		JSONObject json = new JSONObject();

		json.put("day", day3);
		json.put("day1", day4);
		json.put("liang", liang);
		json.put("jia", jia);
		this.sunFa4.jisuan24(json);

		return "";
	}

	@GetMapping("/jisuan25")
	@ResponseBody
	public String jisuan25(HttpServletRequest req) {

		String day6 = req.getParameter("day6");
		String day7 = req.getParameter("day7");
		String jia6 = req.getParameter("jia6");
		String jia7 = req.getParameter("jia7");
		String liang = req.getParameter("liang");
		String jia = req.getParameter("jia");
		String flag = req.getParameter("flag");
		String type = req.getParameter("type");
		JSONObject json = new JSONObject();

		json.put("day6", day6);
		json.put("day7", day7);
		json.put("jia6", jia6);
		json.put("jia7", jia7);
		json.put("liang", liang);
		json.put("jia", jia);
		json.put("flag", flag);
		json.put("type", type);
		JSONArray json1 = this.sunFa4.jisuan25(json);
		return convertJSONArrayToHTMLTable(json1);

	}

	@GetMapping("/getLongtou")
	@ResponseBody
	public String getLongtou(HttpServletRequest req) {

		String textarea1 = req.getParameter("textarea1");
		JSONObject json = new JSONObject();
		json.put("textarea1", textarea1);
		List<String> list = stockService.getallCode1(json);
		for (int i = 0; i < list.size(); i++) {
			list.set(i, list.get(i).replace("sz", "").replace("sh", ""));
		}
		JSONArray json1 = this.sunFa4.getGN(list);
		return convertJSONArrayToHTMLTable(json1);
	}

	@PostMapping("/getCodeCcc")
	@ResponseBody
	public JSONArray getCodeCcc(HttpServletRequest req) {

		// System.out.println("调用一次刷新页面数据");

		String textarea1 = req.getParameter("code1");

		// System.out.println(textarea1);

		String[] str = textarea1.split(",");

		JSONArray list = new JSONArray();
		for (int i = 0; i < str.length; i++) {
			JSONObject json = new JSONObject();
			json.put("code1", str[i]);
			list.add(json);
		}
		String allcode = "";
		for (int i = 0; i < list.size(); i++) {
			JSONObject json = list.getJSONObject(i);
			String code = json.getString("code1");
			// System.out.println(code.indexOf("6"));
			if ("0".equals(code.indexOf("6") + "")) {
				code = "sh" + code;
			} else {
				code = "sz" + code;
			}
			if (i == list.size() - 1) {
				allcode += code;
			} else {
				allcode += code + ",";
			}

			// System.out.println(allcode);
		}
		JSONArray array = getCcc(allcode, 0f);

		for (int i = 0; i < list.size(); i++) {
			JSONObject a = list.getJSONObject(i);
			for (int j = 0; j < array.size(); j++) {
				JSONObject b = array.getJSONObject(j);
				if (b.getString("code").indexOf(a.getString("code1")) > -1) {
					a.put("zhangdiefu", b.getString("zhangdiefu"));
					a.put("jiage", b.getString("jiage"));
					a.put("cjje", b.getString("cjje"));
					a.put("shizhi", b.getString("shizhi"));
					a.put("huanshoulv", b.getString("huanshoulv"));
					a.put("name1", b.getString("name"));
				}
			}
		}
		Comparator<JSONObject> comparator = (jsonObject1, jsonObject2) -> Double.compare(jsonObject2.getDouble("cjje"), jsonObject1.getDouble("cjje"));
		list.sort(comparator);
		return list;

	}

	@GetMapping("/jisuan26")
	@ResponseBody
	public String jisuan26(HttpServletRequest req) {

		List<String> list = stockService.getallCode();
		String text6 = req.getParameter("text6");
		String text6_1 = req.getParameter("text6_1");
		String text6_2 = req.getParameter("text6_2");
		String text6_3 = req.getParameter("text6_3");
		String allcode = "";
		List<String> lists = new ArrayList<String>();
		for (int i = 0; i < list.size(); i++) {

			if (i % 500 == 0 && i != 0) {
				allcode += list.get(i) + "";
				System.out.println(allcode);
				lists.add(allcode);
				allcode = "";
				continue;
			}
			if (i == list.size() - 1) {
				allcode += list.get(i) + "";
				System.out.println(allcode);
				lists.add(allcode);
				break;
			}
			if (i == list.size() - 1) {
				allcode += list.get(i);
			} else {
				allcode += list.get(i) + ",";
			}
		}
		JSONArray jsonarr = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray json1 = getCcc(lists.get(i), 0f);
			jsonarr.addAll(json1);
		}
		for (int i = jsonarr.size() - 1; i >= 0; i--) {
			Float shizhi = Float.parseFloat(jsonarr.getJSONObject(i).getString("shizhi"));
			if (shizhi <= 40 || shizhi >= 400) {
				jsonarr.remove(i);
				continue;
			}
			Float zhangdiefu = Float.parseFloat(jsonarr.getJSONObject(i).getString("zhangdiefu"));
			if (zhangdiefu < Float.parseFloat(text6_3)) {
				jsonarr.remove(i);
				continue;
			}
		}

		List<String> list2 = new ArrayList<String>();
		for (int i = 0; i < jsonarr.size(); i++) {
			list2.add(jsonarr.getJSONObject(i).getString("code").replace("sz", "").replace("sh", ""));
		}

		List<String> list3 = this.sunFa4.get1jin2Code(list2, text6, text6_1);

		JSONArray json1 = this.sunFa4.getGN(list3);

		if (json1 == null) {
			return "";
		}
		for (int i = 0; i < json1.size(); i++) {
			for (int j = 0; j < jsonarr.size(); j++) {
				String code = jsonarr.getJSONObject(j).getString("code").replace("sz", "").replace("sh", "");
				if (json1.getJSONObject(i).getString("code").equals(code)) {
					json1.getJSONObject(i).put("cjje", Float.parseFloat((Float.parseFloat(jsonarr.getJSONObject(i).get("cjje") + "") / 10000 + "").replaceAll("\\..*", "")) + "亿");
					json1.getJSONObject(i).put("jiage", jsonarr.getJSONObject(j).getString("jiage"));
					json1.getJSONObject(i).put("huanshoulv", jsonarr.getJSONObject(j).getString("huanshoulv"));
					json1.getJSONObject(i).put("jiage", jsonarr.getJSONObject(j).getString("jiage"));
					json1.getJSONObject(i).put("zhangdiefu", jsonarr.getJSONObject(j).getString("zhangdiefu"));
					break;
				}

			}
		}

		return convertJSONArrayToHTMLTable(json1);

	}

	@GetMapping("/selectsuanfa")
	@ResponseBody
	public String selectsuanfa(HttpServletRequest req) {

		String suanfa = req.getParameter("suanfa");
		String date = req.getParameter("date");
		JSONObject json = new JSONObject();
		json.put("suanfa", suanfa);
		json.put("date", date);
		JSONArray json1 = this.sunFa4.selectsuanfa(json);
		return convertJSONArrayToHTMLTable(json1);

	}

	@GetMapping("/getCTop10")
	@ResponseBody
	public String getCTop10(HttpServletRequest req) {

		List<String> list = stockService.getallCode();
		String text6 = req.getParameter("text6");
		String temp = req.getParameter("text7");
		String allcode = "";
		List<String> lists = new ArrayList<String>();
		for (int i = 0; i < list.size(); i++) {

			if (i % 500 == 0 && i != 0) {
				allcode += list.get(i) + "";
				System.out.println(allcode);
				lists.add(allcode);
				allcode = "";
				continue;
			}
			if (i == list.size() - 1) {
				allcode += list.get(i) + "";
				System.out.println(allcode);
				lists.add(allcode);
				break;
			}
			if (i == list.size() - 1) {
				allcode += list.get(i);
			} else {
				allcode += list.get(i) + ",";
			}
		}
		JSONArray json = new JSONArray();
		for (int i = 0; i < lists.size(); i++) {
			JSONArray json1 = getCtop10(lists.get(i), Float.parseFloat(text6), temp);
			System.out.println("符合" + temp + "长度：" + json1.size());
			json.addAll(json1);
		}
		List<String> list2 = new ArrayList<String>();
		for (int i = 0; i < json.size(); i++) {
			list2.add(json.getJSONObject(i).getString("code").replace("sz", "").replace("sh", ""));
		}
		JSONArray json1 = this.sunFa4.getGN(list2);

		for (int i = 0; i < json1.size(); i++) {
			for (int j = 0; j < json.size(); j++) {
				String code = json.getJSONObject(j).getString("code").replace("sz", "").replace("sh", "");
				if (json1.getJSONObject(i).getString("code").equals(code)) {
					json1.getJSONObject(i).put("zuigao", json.getJSONObject(j).getString("zuigao"));
					json1.getJSONObject(i).put("zuidi", json.getJSONObject(j).getString("zuidi"));
					json1.getJSONObject(i).put("huanshoulv", json.getJSONObject(j).getString("huanshoulv"));
					json1.getJSONObject(i).put("jiage", json.getJSONObject(j).getString("jiage"));
					json1.getJSONObject(i).put("zhangdiefu", json.getJSONObject(j).getString("zhangdiefu"));
					break;
				}

			}
		}

		return convertJSONArrayToHTMLTable(json1);

	}

	@GetMapping("/tongbujigousuju")
	@ResponseBody
	public JSONArray tongbujigousuju(HttpServletRequest req) {
		this.stockService.addJGCG();

		return null;

	}

	@GetMapping("/loaoSHText")
	@ResponseBody
	public String loaoSHText(HttpServletRequest req) {

		File file = new File("D://openvpn.conf");
		if (!file.exists()) {
			file = new File("/opt/openvpn/openvpn.conf");
		}
		BufferedReader reader;
		StringBuilder content = new StringBuilder();
		try {
			reader = new BufferedReader(new FileReader(file));

			String line;

			while ((line = reader.readLine()) != null) {
				// 将文件中的内容读取到StringBuilder中
				content.append(line).append("\n");
			}
			reader.close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		// 替换文件内容中的数字10000为10001
		String modifiedContent = content.toString();

		File file1 = new File("D://ovpn_env.sh");
		if (!file1.exists()) {
			file1 = new File("/opt/openvpn/ovpn_env.sh");
		}
		BufferedReader reader1;
		StringBuilder content1 = new StringBuilder();
		try {
			reader = new BufferedReader(new FileReader(file1));

			String line;

			while ((line = reader.readLine()) != null) {
				// 将文件中的内容读取到StringBuilder中
				content1.append(line).append("\n");
			}
			reader.close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		modifiedContent += content1.toString();
		return modifiedContent;

	}

	@GetMapping("/setDK1")
	@ResponseBody
	public String setDK1(HttpServletRequest req) {

		// String createTime = req.getParameter("createTime");
		// JSONArray json = this.stockselect.getFenQidayLTList(createTime);

		String dk1 = req.getParameter("dk1");

		String dk2 = req.getParameter("dk2");

		System.out.println("==" + dk1 + dk2);
		try {
			File file = new File("D://openvpn.conf");
			if (!file.exists()) {
				file = new File("/opt/openvpn/openvpn.conf");
			}
			BufferedReader reader = new BufferedReader(new FileReader(file));

			String line;
			StringBuilder content = new StringBuilder();
			while ((line = reader.readLine()) != null) {
				// 将文件中的内容读取到StringBuilder中
				content.append(line).append("\n");
			}
			reader.close();

			// 替换文件内容中的数字10000为10001
			String modifiedContent = content.toString().replace(dk1, dk2);

			// 将修改后的内容写回原文件中
			BufferedWriter writer = new BufferedWriter(new FileWriter(file));
			writer.write(modifiedContent);
			writer.close();

			System.out.println("文件内容修改并写入成功！");
		} catch (IOException e) {
			e.printStackTrace();
		}

		try {
			File file = new File("D://ovpn_env.sh");
			if (!file.exists()) {
				file = new File("/opt/openvpn/ovpn_env.sh");
			}
			BufferedReader reader = new BufferedReader(new FileReader(file));

			String line;
			StringBuilder content = new StringBuilder();
			while ((line = reader.readLine()) != null) {
				// 将文件中的内容读取到StringBuilder中
				content.append(line).append("\n");
			}
			reader.close();

			// 替换文件内容中的数字10000为10001
			String modifiedContent = content.toString().replace(dk1, dk2);

			// 将修改后的内容写回原文件中
			BufferedWriter writer = new BufferedWriter(new FileWriter(file));
			writer.write(modifiedContent);
			writer.close();

			System.out.println("文件内容修改并写入成功！");
		} catch (IOException e) {
			e.printStackTrace();
		}

		try {
			// Command to be executed
			String command = " docker stop ov ";

			String command1 = " docker rm ov ";

			String command2 = " docker run --name ov --restart=always --sysctl net.ipv6.conf.all.forwarding=1  --privileged=true -v /opt/openvpn:/etc/openvpn -d -p " + dk1 + ":" + dk1 + "/tcp --cap-add=NET_ADMIN kylemanna/openvpn:2.4 ";

			ProcessBuilder processBuilder = new ProcessBuilder("bash", "-c", command);
			Process process = processBuilder.start();

			// Read output from the command
			InputStream inputStream = process.getInputStream();
			BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
			String line;

			while ((line = reader.readLine()) != null) {
				System.out.println(line);
			}

			// Wait for the command to finish
			process.waitFor();
		} catch (IOException | InterruptedException e) {
			e.printStackTrace();
		}

		return "";
	}

	public static String convertJSONArrayToHTMLTable(JSONArray jsonArray) {
		StringBuilder htmlTable = new StringBuilder();

		// 创建表格开始标签
		htmlTable.append("<table id='mytalbe'>");
		// System.out.println(jsonArray.size());
		try {
			// 表头行
			if (jsonArray.size() > 0) {
				JSONObject firstObject = jsonArray.getJSONObject(0);
				htmlTable.append("<tr>");
				htmlTable.append("<td name='number' number='-1'>number</td>");
				for (Object key : firstObject.keySet()) {
					htmlTable.append("<td name='" + key + "' >").append(key).append("</td>");
				}
				htmlTable.append("</tr>");
			}

			// 数据行
			for (int i = 0; i < jsonArray.size(); i++) {
				JSONObject jsonObject = jsonArray.getJSONObject(i);
				htmlTable.append("<tr>");
				htmlTable.append("<td name='number' number='" + (i + 1) + "'>" + (i + 1) + "</td>");

				for (Object key : jsonObject.keySet()) {
					if ("name".equals(key)) {
						htmlTable.append("<td    name=" + key + "      name1='" + jsonObject.get(key) + "'>").append(jsonObject.get(key)).append("</td>");
					} else {
						htmlTable.append("<td    name=" + key + "      " + key + "='" + jsonObject.get(key) + "'>").append(jsonObject.get(key)).append("</td>");
					}
				}
				htmlTable.append("</tr>");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		// 创建表格结束标签
		htmlTable.append("</table>");

		return htmlTable.toString();
	}

	/**
	 * 得到当前所有的代码和状态
	 * 
	 * @param codearr
	 * @param temp
	 * @return
	 */
	public static JSONArray getCcc(String codearr, Float temp) {

		JSONArray jsonarrr = new JSONArray();
		CloseableHttpClient httpClient = HttpClients.createDefault();
		HttpGet httpGet = new HttpGet("http://qt.gtimg.cn/q=" + codearr);
		Logger.getLogger("org.apache.http").setLevel(Level.OFF);
		LogFactory.getLog("org.apache.http").debug(httpGet);
		String[] arary = codearr.split(",");
		try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
			HttpEntity entity = response.getEntity();
			if (entity != null) {
				String responseData = EntityUtils.toString(entity);
				// 对返回的responseData进行处理
				String[] str = responseData.split(";");
				for (int i = 0; i < str.length; i++) {
					String[] str1 = str[i].split("~");
					if (str1.length <= 1) {
						continue;
					}
					JSONObject json = new JSONObject();
					json.put("name", str1[1]);
					json.put("jiage", str1[3]);
					json.put("jinkai", str1[5]);
					json.put("code", arary[i]);
					json.put("zhangdiefu", str1[32]);
					json.put("zuidi", str1[34]);
					json.put("cjje", str1[37]);
					json.put("huanshoulv", str1[38]);
					json.put("shizhi", str1[44]);
					jsonarrr.add(json);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				httpClient.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return jsonarrr;
	}

	/**
	 * 得到当前所有的代码和状态
	 * 
	 * @param codearr
	 * @param temp
	 * @return
	 */
	public static JSONArray getCtop10(String codearr, Float temp, String flag) {

		JSONArray jsonarrr = new JSONArray();
		CloseableHttpClient httpClient = HttpClients.createDefault();
		HttpGet httpGet = new HttpGet("http://qt.gtimg.cn/q=" + codearr);

		String[] arary = codearr.split(",");
		try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
			HttpEntity entity = response.getEntity();
			if (entity != null) {
				String responseData = EntityUtils.toString(entity);
				// 对返回的responseData进行处理
				String[] str = responseData.split(";");
				for (int i = 0; i < str.length; i++) {
					String[] str1 = str[i].split("~");
					if (str1.length <= 1) {
						continue;
					}
					Float zhangdiefu = Float.parseFloat(str1[32]);
					if ("0".equals(flag) && zhangdiefu <= temp) {
						JSONObject json = new JSONObject();
						json.put("name", str1[1]);
						json.put("jiage", str1[3]);
						json.put("code", arary[i]);
						json.put("zhangdiefu", str1[32]);
						json.put("zuigao", str1[33]);
						json.put("zuidi", str1[34]);
						json.put("huanshoulv", str1[38]);
						json.put("shizhi", str1[45]);
						jsonarrr.add(json);
					}
					if ("1".equals(flag) && zhangdiefu >= temp) {
						JSONObject json = new JSONObject();
						json.put("name", str1[1]);
						json.put("jiage", str1[3]);
						json.put("code", arary[i]);
						json.put("zhangdiefu", str1[32]);
						json.put("zuigao", str1[33]);
						json.put("zuidi", str1[34]);
						json.put("huanshoulv", str1[38]);
						json.put("shizhi", str1[45]);
						jsonarrr.add(json);
					}

				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				httpClient.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return jsonarrr;
	}

	/**
	 * 得到当前所有的代码和状态
	 * 
	 * @param codearr
	 * @param temp
	 * @return
	 */
	public static JSONArray FQList(String codearr, Float text8, String[] text9, float f) {

		JSONArray jsonarrr = new JSONArray();
		CloseableHttpClient httpClient = HttpClients.createDefault();
		HttpGet httpGet = new HttpGet("http://qt.gtimg.cn/q=" + codearr);

		String[] arary = codearr.split(",");
		try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
			HttpEntity entity = response.getEntity();
			if (entity != null) {
				String responseData = EntityUtils.toString(entity);
				// 对返回的responseData进行处理
				String[] str = responseData.split(";");
				for (int i = 0; i < str.length; i++) {
					String[] str1 = str[i].split("~");
					if (str1.length <= 1) {
						continue;
					}
					Float huanshoulv = Float.parseFloat(str1[38]);
					Float zhangdiefu = Float.parseFloat(str1[32]);
					if (huanshoulv >= text8 && zhangdiefu >= Float.parseFloat(text9[0]) && zhangdiefu <= Float.parseFloat(text9[1])) {
						JSONObject json = new JSONObject();
						json.put("name", str1[1]);
						json.put("jiage", str1[3]);
						json.put("code", arary[i]);
						json.put("zhangdiefu", str1[32]);
						json.put("zuigao", str1[33]);
						json.put("zuidi", str1[34]);
						json.put("huanshoulv", str1[38]);
						json.put("cjje", str1[37]);
						json.put("shizhi", str1[45]);

						Float f1g = Float.parseFloat(str1[33] + "");
						Float f2d = Float.parseFloat(str1[34] + "");

						if (Float.parseFloat(str1[45] + "") > 350f || Float.parseFloat(str1[45] + "") <= 40f) {
							continue;
						}

						jsonarrr.add(json);
					}

				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				httpClient.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return jsonarrr;
	}

}
